﻿using EasyCore.DataValidation;
using Microsoft.Identity.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EasyCore.EndpointAudits
{
    /// <summary>
    /// 终节点审计选项
    /// </summary>
    public class EndpointAuditOption
    {
        /// <summary>
        /// 启用终节点审计
        /// </summary>
        public bool EnableEndpointAudit { get; set; } = true;

        /// <summary>
        /// 是否禁用请求重复性提交：默认禁止
        /// </summary>
        public bool DisableRepeatSubmitValidation { get; set; } = false;
       /// <summary>
       /// 是否保存数据：默认保存
       /// </summary>
        public bool DisableAuditLogSave { get; set; } = false;


        /// <summary>
        ///终结点处理器
        /// </summary>
        public Type? EndpointAuditHandler { get; private set; } = null;

        /// <summary>
        /// 重写终结点的处理器
        /// </summary>
        /// <typeparam name="TResultFactory"></typeparam>
        public void OverrideEndpointAuditHandlerWith<TResultFactory>() where TResultFactory : IEndpointAuditHandler {
            EndpointAuditHandler = typeof(TResultFactory);
        }  
    }
}
